from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from django.conf import settings

def generic_email_verify_token(user_id):

    s=Serializer(secret_key=settings.SECRET_KEY,expires_in=3600*24)
    data=s.dumps({'user_id':user_id})
    return data.decode()

def check_verify_token(token):
    s=Serializer(secret_key=settings.SECRET_KEY,expires_in=3600*24)
    try:
        data=s.loads(token)
    except:
        return None
    return data.get('user_id')